using UnityEngine;

public class ColliderEnabler : MonoBehaviour
{
	private void Start()
	{
		DisableColliders();
		Invoke("EnableColliders", 1f);
	}

	private void OnEnable()
	{
		Invoke("EnableColliders", 1f);
	}

	private void EnableColliders()
	{
		BoxCollider[] componentsInChildren = GetComponentsInChildren<BoxCollider>();
		foreach (BoxCollider boxCollider in componentsInChildren)
		{
			boxCollider.enabled = true;
		}
		UIButton[] componentsInChildren2 = GetComponentsInChildren<UIButton>();
		foreach (UIButton uIButton in componentsInChildren2)
		{
			uIButton.SetState((!uIButton.enabled) ? UIButtonColor.State.Disabled : UIButtonColor.State.Normal, false);
		}
	}

	private void DisableColliders()
	{
		BoxCollider[] componentsInChildren = GetComponentsInChildren<BoxCollider>();
		foreach (BoxCollider boxCollider in componentsInChildren)
		{
			boxCollider.enabled = false;
		}
	}

	private void OnDisable()
	{
		EnableColliders();
	}
}
